﻿#region File and License Information
/*
<File>
	<License>
		Copyright © 2009 - 2017, Daniel Vaughan. All rights reserved.
		This file is part of Calcium (http://calciumsdk.net), 
		which is released under the MIT License.
		See file /Documentation/License.txt for details.
	</License>
	<CreationDate>2013-04-18 15:27:07Z</CreationDate>
</File>
*/
#endregion

using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;

namespace Outcoder.Logging
{
	/// <summary>
	/// Represents a output channel for storing or transmitting log messages.
	/// </summary>
	public interface ILog
	{
		/// <summary>
		/// Writes a message to the log. 
		/// This is the usual override point for an implementation of an <c>ILog</c> implementation.
		/// </summary>
		/// <param name="logLevel">Is used by filters to decide whether to process the message.</param>
		/// <param name="message">The textual content of the entry.</param>
		/// <param name="exception">Can be null.</param>
		/// <param name="properties">Can be null. A optional list of properties 
		/// that may (or may not) be used by a particular <c>ILog</c> implementation.</param>
		/// <param name="memberName">The current member.</param>
		/// <param name="filePath">The name of the file.</param>
		/// <param name="lineNumber">The originating line number.</param>
		Task WriteAsync(
			LogLevel logLevel,
			string message,
			Exception exception,
			IDictionary<string, object> properties,
			[CallerMemberName]string memberName = null,
			[CallerFilePath] string filePath = null,
			[CallerLineNumber] int lineNumber = 0);

		bool IsLogEnabledForLevel(LogLevel logLevel);

		void Trace(
			string message,
			Exception exception = null,
			IDictionary<string, object> properties = null,
			[CallerMemberName]string memberName = null,
			[CallerFilePath] string filePath = null,
			[CallerLineNumber] int lineNumber = 0);

		void Debug(
			string message,
			Exception exception = null,
			IDictionary<string, object> properties = null,
			[CallerMemberName]string memberName = null,
			[CallerFilePath] string filePath = null,
			[CallerLineNumber] int lineNumber = 0);

		void Info(
			string message,
			Exception exception = null,
			IDictionary<string, object> properties = null,
			[CallerMemberName]string memberName = null,
			[CallerFilePath] string filePath = null,
			[CallerLineNumber] int lineNumber = 0);

		void Warn(
			string message,
			Exception exception = null,
			IDictionary<string, object> properties = null,
			[CallerMemberName]string memberName = null,
			[CallerFilePath] string filePath = null,
			[CallerLineNumber] int lineNumber = 0);

		void Error(
			string message,
			Exception exception = null,
			IDictionary<string, object> properties = null,
			[CallerMemberName]string memberName = null,
			[CallerFilePath] string filePath = null,
			[CallerLineNumber] int lineNumber = 0);

		void Fatal(
			string message,
			Exception exception = null,
			IDictionary<string, object> properties = null,
			[CallerMemberName]string memberName = null,
			[CallerFilePath] string filePath = null,
			[CallerLineNumber] int lineNumber = 0);

		bool TraceEnabled { get; }
		bool DebugEnabled { get; }
		bool InfoEnabled { get; }
		bool WarnEnabled { get; }
		bool ErrorEnabled { get; }
		bool FatalEnabled { get; }
	}
}